package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class GenericDemo {
    public static void main(String[] args) {
        Collection<String> c =new ArrayList<>();
        c.add("hello");
        c.add("#");
        c.add("world");
        c.add("#");
        c.add("mygirl");
        Collection<Integer> b=new ArrayList<>();
        b.add(Integer.valueOf(5677));
        Iterator<String> it =c.iterator();
        Collection<String> code=new ArrayList<>();
        while(it.hasNext())
        {
            String str=it.next();
            System.out.println(str);

            if("#".equals(str)!=true){//c.remove("#")
                code.add(str);
            }
        }
        c= code;
        System.out.println(c);
    }
}
